#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>

#include <pthread.h>

static void* my_thread_fn(void* args)
{
    printf("T: pid=%d, tid=%d\n", getpid(), syscall(SYS_gettid));
    pthread_exit(NULL);
}



int main(int argc, char *argv[])
{
	pthread_t mythread;
	int ret;

	printf("P: pid=%d, tid=%d\n", getpid(), syscall(SYS_gettid));

	ret = pthread_create(&mythread, NULL, my_thread_fn, NULL);
	if (ret) {
		printf("pthread_create failed, ret=%d\n", ret);
		return -1;
	}

	pthread_join(mythread, NULL);

	return 0;
}
